package com.sphd.emanu.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.pojo.goods.Category;
import com.sphd.emanu.pojo.material.Material;
import com.wzutils.L;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/5/26 --16:52.
 * @Email 87683202@qq.com
 */
public class MaterialAdapter extends BaseQuickAdapter<Material,BaseViewHolder> {
    public MaterialAdapter(@LayoutRes int layoutResId, @Nullable List<Material> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Material item) {

        L.e(item.getCategoryName());


        helper
                .setText(R.id.item_category,item.getName())
                .setText(R.id.item_material_type,"物料类型："+item.getCategoryName())
                .setText(R.id.item_specification,"规格："+(item.getSpecifications()!=null?item.getSpecifications():"暂无设定"))
                .setText(R.id.item_storage_loc,"库位"+ (item.getStorage()!=null?(item.getStorage().getName()+"#"):"??#"))
                .setText(R.id.item_stock,"当前库存:"+(item.getStockInfo()!=null?item.getStockInfo().getStock():"暂无库存"))
                .setText(R.id.item_minimum_stock,"最低库存:"+(item.getStockInfo()!=null?item.getStockInfo().getMinimumStock():"暂无最低库存"));
    }


}
